﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SchnelleKarten
{
    public class WorkPile
    {
        public List<Card> Pile;
        bool player;

        public WorkPile()
        {
            Pile = new List<Card>();
            player = false;
        }

        public WorkPile(bool p)
        {
            Pile = new List<Card>();
            player = p;
        }

        public bool CanAddCard(Card card)
        {
            if (Pile.Count == 0)
                return true;
            else if ((card.Suit.Equals("Spade") || card.Suit.Equals("Club"))
                && (Pile.Last<Card>().Suit.Equals("Heart") || Pile.Last<Card>().Suit.Equals("Diamond")))
            {
                if (card.Value == Pile.Last<Card>().Value - 1)
                    return true;
            }
            else if ((card.Suit.Equals("Heart") || card.Suit.Equals("Diamond"))
                && (Pile.Last<Card>().Suit.Equals("Spade") || Pile.Last<Card>().Suit.Equals("Club")))
            {
                if (card.Value == Pile.Last<Card>().Value - 1)
                    return true;
            }

            return false;
        }
    }
}
